Partial Public Class FrmDetalleDeFacturaCompra
    Inherits System.Web.UI.Page
    Public Detalle As CapaDeNegocios.nDetalleFactura = New CapaDeNegocios.nDetalleFactura
    Public Factura As CapaDeNegocios.nFacturaCompra = New CapaDeNegocios.nFacturaCompra
    Public Proveedor As CapaDeNegocios.nProveedor = New CapaDeNegocios.nProveedor
    Public Condicion As CapaDeNegocios.nCondicion = New CapaDeNegocios.nCondicion
    Dim IdFactura As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("Login") = "Anonimo" Then
            Response.Redirect("/")
        End If
        If Not Page.IsPostBack Then

            IdFactura = Request.QueryString("IDFactura")
            'IdFactura = "2"
            If IdFactura <> "" Then
                LlenarCuerpo()
            End If

        End If
    End Sub
    Sub LlenarCuerpo()
        Dim dts As DataSet = Factura.ListarFacturas(IdFactura, 0, "", "", 0, 0, "", "")

        LblNumero.Text = dts.Tables(0).Rows(0)("Numero").ToString()
        LblProveedor.Text = Proveedor.Listar(dts.Tables(0).Rows(0)("codigoprov").ToString(), "", "", "", "", "", "", "").Tables(0).Rows(0)("razonSocial").ToString()
        LblIva.Text = dts.Tables(0).Rows(0)("iva").ToString()
        LblEstado.Text = dts.Tables(0).Rows(0)("Estado").ToString()
        LblTotal.Text = dts.Tables(0).Rows(0)("Total").ToString()
        LblCondicion.Text = Condicion.Listar(CInt(dts.Tables(0).Rows(0)("IdCondCompra").ToString()), "", 0, "").Tables(0).Rows(0)("Descripcion").ToString()
        TxtObservacion.Text = dts.Tables(0).Rows(0)("Observacion").ToString()
        LlenarGrid()

    End Sub
    Sub LlenarGrid()
        GridDetalle.DataSource = Detalle.BuscarFiltrado("", "", "", "", "", IdFactura, "")
        GridDetalle.DataBind()
    End Sub
End Class